home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 11 - 1995 / 11.04 Apr 95 / TreeAppƒ / Application Shellƒ / CPPTreeAppMenuBar.cp < prev    next >
Encoding:
Text File  |  1996-04-04  |  3.1 KB  |  118 lines  |  [TEXT/KAHL]

  1. /***************************************************** IMPLEMENTATION
  2.     DATE:    9/20/93
  3.  
  4.     CLASS:  CPPTreeAppMenuBar
  5.     
  6.     SUPERCLASS: CPPMenuBar
  7.     
  8.         This C++ class manages the menu bar for our application
  9.     
  10. ********************************************************************/
  11.  
  12. #pragma once
  13.  
  14. #include "CPPTreeAppMenuBar.h"
  15. #include "CPPTreeAppMenuBar.h"
  16. #include "MyCommands.h"
  17. #include <Commands.h>
  18.  
  19. extern    Boolean                gQuitApp;
  20.  
  21. /*-----------------------------------------------------------------*/
  22.  
  23. #define    kAppleMenu        1028
  24. #define        kAbout        1
  25.  
  26. #define    kFileMenu        1029
  27. #define        kQuit        1
  28.  
  29. #define    kTreeMenu        1030
  30. #define        kLength        4
  31. #define        kAdd        6
  32. #define        kInsert        7
  33. #define        kDeleteNode    8
  34. #define        kDeleteFamily    9
  35. #define        kChangeNode    10
  36. #define        kCopyTree    12
  37.  
  38. #define    kOrientMenu        128
  39. #define        kTopDown    1
  40. #define        kBottomUp    2
  41. #define        kLeft2Right    4
  42. #define        kRight2Left    5
  43.  
  44. #define    kJustMenu        129
  45. #define        kRightJust    1
  46. #define        kLeftJust    2
  47. #define        kCenterJust    3
  48.  
  49. #define    kJoinMenu        130
  50. #define        kJoinNone    1
  51. #define        kJoinAngle    2
  52. #define        kJoinPoint    3
  53.  
  54. /*-----------------------------------------------------------------*/
  55. /*------------------------ PUBLIC METHODS -------------------------*/
  56. /*-----------------------------------------------------------------*/
  57.  
  58.     CPPTreeAppMenuBar::CPPTreeAppMenuBar (void) : CPPMenuBar (128, 1028)
  59.     /* create a menu bar based on the passed-in resource template */
  60.     {
  61.         AddDAs (kAppleMenu);
  62.         SetUpHierMenus (128, 130);
  63.         SetCommandBindings();
  64.     }
  65.  
  66. /*-----------------------------------------------------------------*/
  67.  
  68.     CPPTreeAppMenuBar::~CPPTreeAppMenuBar (void)
  69.     {
  70.     }
  71.  
  72. /*-----------------------------------------------------------------*/
  73.  
  74.     Boolean    CPPTreeAppMenuBar::Member (char *className)
  75.     {
  76.         if (strcmp(className, CPPTreeAppMenuBar::ClassName()) == 0)
  77.           return TRUE;
  78.         else
  79.           return CPPMenuBar::Member(className);
  80.     }
  81.  
  82. /*-----------------------------------------------------------------*/
  83.  
  84.     char    *CPPTreeAppMenuBar::ClassName (void)
  85.     {
  86.         return "CPPTreeAppMenuBar";
  87.     }
  88.  
  89. /*-----------------------------------------------------------------*/
  90.  
  91.     void    CPPTreeAppMenuBar::SetCommandBindings (void)
  92.     {
  93.         BindCommand(kAppleMenu, kAbout, kCmdAbout);
  94.  
  95.         BindCommand(kFileMenu, kQuit, kCmdQuit);
  96.         
  97.         BindCommand (kTreeMenu, kAdd, kCmdAdd);
  98.         BindCommand (kTreeMenu, kInsert, kCmdInsert);
  99.         BindCommand (kTreeMenu, kDeleteNode, kCmdDeleteNode);
  100.         BindCommand (kTreeMenu, kDeleteFamily, kCmdDeleteFamily);
  101.         BindCommand (kTreeMenu, kChangeNode, kCmdChangeNode);
  102.         BindCommand (kTreeMenu, kLength, kCmdLength);
  103.         BindCommand (kTreeMenu, kCopyTree, kCmdCopy);
  104.         
  105.         BindCommand (kOrientMenu, kTopDown, kCmdTopDown);
  106.         BindCommand (kOrientMenu, kBottomUp, kCmdBottomUp);
  107.         BindCommand (kOrientMenu, kLeft2Right, kCmdLeft2Right);
  108.         BindCommand (kOrientMenu, kRight2Left, kCmdRight2Left);
  109.  
  110.         BindCommand (kJustMenu, kRightJust, kCmdRightJust);
  111.         BindCommand (kJustMenu, kLeftJust, kCmdLeftJust);
  112.         BindCommand (kJustMenu, kCenterJust, kCmdCenterJust);
  113.  
  114.         BindCommand (kJoinMenu, kJoinNone, kCmdJoinNone);
  115.         BindCommand (kJoinMenu, kJoinAngle, kCmdJoinAngle);
  116.         BindCommand (kJoinMenu, kJoinPoint, kCmdJoinPoint);
  117.     }
  118.